package com.balloon.gateway.security.service;

import com.balloon.gateway.security.user.dao.SystemUserDao;
import com.balloon.gateway.security.user.entity.SystemUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;


@Service
public class UserSmsDetailsServiceImpl {

    @Autowired
    private SystemUserDao systemUserDao;


    public SystemUser findByByPhone(String phone) {

        SystemUser byPhone = systemUserDao.findByPhone(phone);
        if(byPhone == null){
            throw new UsernameNotFoundException("用户不存在");
        }
        return byPhone;
    }
}
